from rest_framework_simplejwt.serializers import TokenObtainPairSerializer


class CustomTokenObtainPairSerializer(TokenObtainPairSerializer):
    def validate(self, attrs):
        data = super(CustomTokenObtainPairSerializer, self).validate(attrs)
        # 此处修改需要返回的内容
        # data['token'] = data.pop('access')
        # data['username'] = self.user.username
        # data['id'] = self.user.id
        # data['roles'] = (group.name for group in self.user.groups.all())

        return data
